package chapter04;




class Hero{
    int hp;//血量
    int mp;//蓝条
    int length;//攻击距离
    int move;//移动距离
    int speed;//攻速
    int cs;//暴击

    public void action (String downkey){
        if (downkey.equals("Ctrl + 6")) {
            System.out.println("亮狗牌");
        }
    }
}
class Warrior extends Hero{//战士继承英雄属性

}
class Archer extends  Hero{
    //重写
    public void action (String downkey){
        if (downkey.equals("Ctrl+1")){
            System.out.println("在别的游戏里我可是主角");
        }
    }
}
public class Demo1{
    /**
     * 1.继承
     * 2.重写
     */
    public static void main(String[] args) {
        Warrior jiansheng = new Warrior();
        jiansheng.hp = 645;//给战士赋值初始生命值
        Archer ez = new Archer();
        ez.length = 525;
        ez.action("Ctrl + 1");
    }
}
